package locpris.swan.ac.uk;

import com.jme.math.Vector3f;

public class Neighbour 
{
	
	private String neighbourName="";
	private int bmu = 0;
	private Vector3f location= null;
	
	public Neighbour(String apname, int weight,Vector3f loc)
	{
		neighbourName=apname;
		bmu = weight;		
		setLocation(loc);
		System.out.println("new newighbour "+apname+" with weight "+weight+" at " +loc.x + ","+loc.z);
	}
	
	public String getNeighbourName()
	{
		return neighbourName;
	}
	
	public int getNeighbourBMU()
	{
		return bmu;
	}
	
	public void setLocation(Vector3f loc)
	{
		this.location = loc;
	}
	
	public Vector3f getLocation()
	{
		return this.location;
	}
	
	public boolean newWeight(int weight)
	{
		if (weight < bmu) 
		{
			System.out.println("New BMU of "+weight+" for "+neighbourName);
			bmu = weight;		
			return true;
		}
	else
	{
		System.out.println("Weight of "+weight+" insufficient for "+neighbourName+"="+bmu);
		return false;
	}
	}

}
